package ScreensManager.GameScreens
{
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	import flash.media.Sound;
	import flash.media.SoundChannel;
	import Utils.Util;
	
	/**
	 * ...
	 * @author ...
	 */
	public class ButtonScreen extends MovieClip
	{
		private var btn:MovieClip;
		
		private var screenReference:int;
		
		private var audio:Sound;
		private var args:*;
		
		public function ButtonScreen(btnReference:MovieClip, screens:int, x:int, y:int, btnAudio:Sound=null) 
		{
			this.screenReference = screens;
			this.btn = btnReference;
			
			this.btn.x = x;
			this.btn.y = y;
			
			this.btn.addEventListener(MouseEvent.MOUSE_DOWN, MouseDown, false, 0, true);
			this.btn.addEventListener(MouseEvent.MOUSE_UP, MouseUp, false, 0, true);
			
			this.audio = btnAudio;
			
			this.addChild(btn);
		}
		
		public function setArgs(args:*):*
		{
			this.args = args;
		}
		private function MouseDown(e:MouseEvent):void 
		{
			//Play();
//			ScreenManager.setCurrentScreen(screenReference,args);
		}
		
		private function MouseUp(e:MouseEvent):void
		{

		}
		
		public function update():void
		{
		
		}
		
		public function removeListeners():void
		{
			this.btn.removeEventListener(MouseEvent.MOUSE_DOWN, MouseDown);
			this.btn.removeEventListener(MouseEvent.MOUSE_UP, MouseUp);
		}
		
		protected function Play()
		{
			if (this.audio != null)
			{
				var soundChannel:SoundChannel = this.audio.play();
				Util.Volume(soundChannel);
			}
		}
		
	}
}